package cn.iocoder.yudao.module.project.dal.mysql.deptcompletedlog;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.project.dal.dataobject.deptcompletedlog.DeptCompletedLogDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.project.controller.admin.deptcompletedlog.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 课室完成记录 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface DeptCompletedLogMapper extends BaseMapperX<DeptCompletedLogDO> {

    default PageResult<DeptCompletedLogDO> selectPage(DeptCompletedLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DeptCompletedLogDO>()
                .eqIfPresent(DeptCompletedLogDO::getOrderCode, reqVO.getOrderCode())
                .eqIfPresent(DeptCompletedLogDO::getInternalCode, reqVO.getInternalCode())
                .eqIfPresent(DeptCompletedLogDO::getProductionCode, reqVO.getProductionCode())
                .eqIfPresent(DeptCompletedLogDO::getType, reqVO.getType())
                .betweenIfPresent(DeptCompletedLogDO::getLastCollectionTime, reqVO.getLastCollectionTime())
                .likeIfPresent(DeptCompletedLogDO::getDeptName, reqVO.getDeptName())
                .eqIfPresent(DeptCompletedLogDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(DeptCompletedLogDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(DeptCompletedLogDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DeptCompletedLogDO::getId));
    }

    Long getDeptFinishCount(@Param("orderDetailId") String orderDetailId, @Param("deptName") String deptName);

}